package com.xuan.shop.dao;

import com.xuan.shop.entity.Car;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ICarDao extends JpaRepository<Car,Integer> {
    List<Car> findAllByBrand(Integer brand);
    @Query(value = "select * from car_tab where car_brand =?",nativeQuery = true)
    List<Car> findAllByBrands(Integer... brands);
    @Query(value = "select count(*) as value,car_type as name from car_tab group by car_type",nativeQuery = true)
    Object[] countCarByType();
}
